Skip to content

feat(reminder): Use system TTS to announce schedule details when the reminder rings - #344

Merged
gac0812 merged 3 commits into
1024XEngineer:mainfrom
gac0812:feat/reminder-tts-voice
Aug 21, 2026
Merged

feat(reminder): Use system TTS to announce schedule details when the reminder rings#344
gac0812 merged 3 commits into
1024XEngineer:mainfrom
gac0812:feat/reminder-tts-voice

Conversation

@gac0812

@gac0812 gac0812 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

改动内容

响铃语音从"打包音频循环播放"改为系统 TextToSpeech 合成播报日程内容,按闹钟声道(STREAM_ALARM)循环播报,可被媒体音量独立控制。

播报文案

  • 新增 ReminderSpeechFormatter(安卓)与 reminderSpeech.ts(JS),生成如「晨会,时间到了。现在已经9点0分了。」的文案
  • 整点播"X点",非整点播"X点X分";日程跨天时带"X月X日"
  • 标题超长(>80 字)截断,空标题回退"未命名日程"

数据链路

  • speech_text 贯穿全链路:JS 端 LocalReminderApplication 计算 → NativeAlarmScheduler/TimeflowAlarmBridge → 安卓 AlarmModuleAlarmScheduler 持久化 → 触发时 AlarmSoundService 取出并 TTS 播报
  • 兼容旧数据:已持久化的旧闹钟无 speech_text 时,由 ExtractedExtras.from 按当前时间回退生成

安卓侧

  • TextToSpeech 优先简体中文语音,缺失回退系统默认语言
  • 音频属性 USAGE_ALARM,播报完成后 1.5s 循环

测试

  • 新增 ReminderSpeechFormatterTest(安卓单测)覆盖整点/非整点/跨天/超长标题/空标题
  • 新增 ReminderSpeechFormatterTest 对应的 JS 文案格式测试
  • 更新 nativeAlarmScheduler.test.ts 适配 native.schedule 新增的第 4 个 speechText 参数,并新增一条断言 speech_text 被正确转发

本地验证

  • ./gradlew :timeflow-alarm:testDebugUnitTest
  • npm run check(lint + format + typecheck + 64 套件 597 测试)✅
  • npx expo export --platform android

Closes #350

- 新增 ReminderSpeechFormatter / reminderSpeech:按「标题,时间到了,现在已经X点X分了」生成播报文案
- speech_text 贯穿 JS → 闹钟模块 → 持久化 → 触发全链路
- 安卓端把原打包音频循环播放换成系统 TextToSpeech 合成播报(优先中文,缺失回退系统默认),按闹钟声道循环
- 新增 ReminderSpeechFormatterTest 覆盖整点/格式/超长标题等边界
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

The JS-to-native scheduling and persistence additions are wired consistently, and the formatter coverage is focused. One Android intent handoff still drops the new speech payload, so the advertised schedule-specific TTS text is not used on the normal firing path (and on snooze retries). The fixed-range diff is clean under git diff --check; the advertised Gradle test could not be run because this checkout has no Gradle wrapper, and the JS test command is blocked by a non-executable local vitest binary.

Forward the JS-generated reminder speech through receiver, full-screen activity, service, and snooze rescheduling paths. Add regression coverage for native intent forwarding and the JS formatter fallback branches.
@gac0812

gac0812 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

Codecov follow-up: commit 1079e8d adds reminderSpeech.test.ts covering missing schedule time, invalid timestamps, invalid timezones, all-day/timed formatting, and title normalization. Local Jest coverage reports 24/24 lines covered for src/features/reminder/domain/reminderSpeech.ts. The targeted formatter suite passes (6 tests); the full local Jest run passes 64 suites / 591 tests when excluding the pre-existing ScheduleCalendarScreen.test.tsx assertion affected by unrelated working-tree changes.

@gac0812 gac0812 changed the title feat(reminder): 响铃用系统 TTS 合成语音播报日程内容 feat(reminder): Use system TTS to announce schedule details when the reminder rings Aug 21, 2026
@gac0812
gac0812 merged commit a83cf43 into 1024XEngineer:main Aug 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(reminder): 响铃时使用系统 TTS 播报日程内容

2 participants